<template>
  <basic-header
    :parent-name="useI18nContent('menus.admin')"
    class="p-[16px] bg-white rounded-bl rounded-br"
  ></basic-header>
  <div class="flex-1 p-6 overflow-hidden">
    <el-scrollbar class="h-full">
      <basic-card title="超管信息">
        <el-descriptions
          class="max-w-5xl basic-descriptions"
          :column="2"
          size="large"
          border
        >
          <el-descriptions-item label="用户名">{{
            record?.username || '-'
          }}</el-descriptions-item>
          <el-descriptions-item label="邮箱">{{
            record?.email || '-'
          }}</el-descriptions-item>
          <el-descriptions-item label="电话">{{
            record?.phone || '-'
          }}</el-descriptions-item>
          <el-descriptions-item label="个人网站">{{
            record?.website || '-'
          }}</el-descriptions-item>
          <el-descriptions-item label="地址" :span="2">{{
            record?.address || '-'
          }}</el-descriptions-item>
          <el-descriptions-item label="最后一次登录IP" :span="2">{{
            record?.lastIp || '-'
          }}</el-descriptions-item>
          <el-descriptions-item label="最后一次登录时间" :span="2">{{
            record?.last_login_at || '-'
          }}</el-descriptions-item>
          <el-descriptions-item label="简介" :span="2">{{
            record?.description || '-'
          }}</el-descriptions-item>
        </el-descriptions>
        <el-divider class="mt-10 mb-8" />
      </basic-card>
    </el-scrollbar>
  </div>
</template>

<script setup lang="ts">
import { ElLoadingService } from 'element-plus'

import type { UserModel } from '@/apis/model/user'
const route = useRoute()
const router = useRouter()

const record = ref<UserModel>()
/**
 * 获取详情方法
 */
const getRecordInfo = () => {
  const loading = ElLoadingService()
  // 模拟接口
  setTimeout(() => {
    record.value = {
      username: 'Ervin Howell',
      email: 'l.abaong@gtkq.sa',
      phone: '010-692-6593 x09125',
      website: 'www.izlr.gu',
      id: String(route.params?.id),
      name: 'Donald Williams',
      address: '广东省 韶关市 新丰县',
      lastIp: '192.168.2.6',
      created_at: 0,
      last_login_at: 0,
      description:
        'Uubiztp oupyj lgjnhghbc qvei dxlppprjs vgjrsvz nikuej hqjvtgsib xpnsgoy xsllqvxdx rjzk icscd qvdmjkovc wghrwk. Xikdozj doaeso qgpfgja lnuwbvtewk meewb fyeqissqq myqmlhgqq gsaooisqy fgweljp rcrrpm pxatyhsmag evkb uesccl didrw. Ubkkhip nrkbihu fnlydnpr uvnkssfv pdqekr jew bpel obumrmy oakm gpqh ltlrqln tkoju qesmn vit hnqxz.'
    }
    loading.close()
  }, 1000)
}

onMounted(() => {
  if (!route.params?.id) {
    ToastUtils.error('用户id错误')
    router.back()
  }
  getRecordInfo()
})
</script>
